﻿using System;
using System.Collections.Generic;
using System.Text;

using Walkmen.OpenMG;

namespace Walkmen.Convert
{
    public class FrameHandlerFactory
    {
        private static readonly FrameHandlerFactory __instance = new FrameHandlerFactory();

        protected FrameHandlerFactory()
        {
        }

        public static FrameHandlerFactory GetInstance()
        {
            return __instance;
        }

        public IFrameHandler GetHandler(string frameId)
        {
            if (frameId == OMATXXXFrame.FRAME_ID)
            {
                return new TextExtensionHandler();
            }
            else if (frameId == OMAGEOBFrame.FRAME_ID)
            {
                return new PictureHandler();
            }
            else if (frameId.StartsWith("T", StringComparison.Ordinal))
            {
                return new TextHandler();
            }
            else
            {
                return null;
            }
        }
    }
}
